package com.leng.asynchronous.rabbitListener;


import com.leng.common.constant.Constants;
import com.leng.common.utils.ServletUtils;
import com.leng.logger.admin.service.IAdminLogininforService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

@Slf4j
@Component
public class LoginRabbitListener {

    @Autowired
    private IAdminLogininforService adminLogininforService ;

    /**
     * 异步执行登录结果---->插入记录表
     * @param maps
     */
    @RabbitListener(queues  = Constants.LOGIN_ASYNCHRONOUS)
    @RabbitHandler
    public void login(HashMap<String,Object> maps){
        System.out.println("Maps:" + maps);
        adminLogininforService.addAdminLogininfor(maps);
        log.error("Maps:"+maps);
    }
}
